<?php

namespace App\Http\Controllers\Admin\Ca;

use App\Http\Controllers\Admin\BaseController;
use App\Http\Requests\Admin\Ca\HandoverRecordSaveRequest;
use App\Repositories\Ca\CustomerRepository;
use App\Repositories\Ca\HandoverRecordRepository;
use App\Utils\Output;
use App\Utils\ViewHelper;
use Illuminate\Http\Request;

class HandoverRecordController extends BaseController
{
    public function __construct()
    {
        $this->set('ca/handover-record');
    }

    function index()
    {
        return $this->view('index');
    }

    function pager(HandoverRecordRepository $rep, Request $request)
    {
        return $rep->adminPager($request->all());
    }

    function caller()
    {
        return $this->view('caller');
    }

    function saveCaller(HandoverRecordSaveRequest $request, CustomerRepository $repository)
    {
        return $repository->handover($request->get('from', 0), $request->get('to', 0), 2);
    }

    function customService()
    {
        return $this->view('custom-service');
    }

    function saveCustomService(HandoverRecordSaveRequest $request, CustomerRepository $repository): Output
    {
        return $repository->handover($request->get('from', 0), $request->get('to', 0), 1);
    }

}